<?php

declare(strict_types=1);
/**
 * Created by PhpStorm.
 * User: yangfan
 * Date: 2019/11/23
 * Time: 3:45 PM
 */

namespace App\Entity;

use App\Models\Distributor;

class DistributorEntity extends ABaseEntity
{
    public function __construct(Distributor $model)
    {
        $this->model = $model;
    }

    /**
     * @return DistributorEntity/null
     */
    public static function findByDisId(int $id)
    {
        $distributor = Distributor::where('dis_id', '=', $id)->first();

        return new self($distributor);
    }

    /**
     * 分销商ID
     *
     * @return int
     */
    public function getDisId()
    {
        return $this->model->dis_id;
    }

    /**
     * 分销商ID
     */
    public function setDisId(int $disId)
    {
        $this->model->dis_id = $disId;
    }

    /**
     * 分销商 name
     *
     * @return string
     */
    public function getDisName()
    {
        return $this->model->dis_name;
    }

    /**
     * 分销商ID
     */
    public function setDisName(string $disName)
    {
        $this->model->dis_name = $disName;
    }

    /**
     * 分销商 phone
     *
     * @return string
     */
    public function getPhone()
    {
        return $this->model->phone;
    }

    /**
     * 分销商 phone
     */
    public function setPhone(string $phone)
    {
        $this->model->phone = $phone;
    }

    /**
     * @return float
     */
    public function getFreezeBalance()
    {
        return $this->model->freeze_balance;
    }

    /**
     * @return float
     */
    public function getPreBalance()
    {
        return $this->model->pre_balance;
    }

    /**
     * @return float
     */
    public function getBalance()
    {
        return $this->model->balance;
    }

    public function setBalance($balance)
    {
        $this->model->balance = $balance;
    }
}
